 |
|
 |
Subject: SOLUTION: Error calling method 'xyz' on an object of type 'function [JavaScript Object]' |
 |
 |
 |
Product Area: Domino Designer on Eclipse (DDE) |
 |
Technical Area: Functionality |
 |
Platform: Windows XP client |
 |
Release: 8.5.1 |
 |
Reproducible: Not applicable |
 |
 |
 |
 |
In XPages, I had a run time error. Specifically:
Error calling method 'appendItemValue(string, string)' on an object of type 'function [JavaScript Object]'
This was from code like:
var docX:NotesDocument=db.CreateDocument;
docX.appendItemValue("Form","FormX");
I searched around and couldn't find the problem, so now that I've got the solution, I'm sharing. The problem was that I had forgotten the parentheses at the end of CreateDocument. Therefore, I was assigning the JavaScript function of NotesDatabase.CreateDocument (a function is an object in JavaScript) to docX, not executing NotesDatabase.CreateDocument() and returning the output. Easy mistake, easy fix.
So, the error message makes complete sense to me _now_, but since this was the first time I've made this mistake, it took quite a lot of fiddling before realizing what the problem was.
Hopefully this post will help someone out.
The biggest surprise to me from all this is: I had declared docX as a NotesDocument and I thought this was strict datatyping, but apparently server side JavaScript doesn't pay attention to declared datatypes or else the first line of the above code should have failed because a NotesDocument is not an ancestor of a JavaScript function object.
 
Feedback number WEBB7ZE8YR created by ~Holly Brefreemannivu on 01/05/2010

Status: Open
Comments:

|
|  |
|